package it.softphone.cmc.server.service.listener;

import it.softphone.cmc.server.entity.AccountPreferenceEntity;
import it.softphone.cmc.server.service.exception.CMCException;
import it.softphone.commons.service.LogAware;

import javax.persistence.PostLoad;


public class AccountPreferenceEntityListener implements LogAware {

	/**
	 * Actually post load doesn't work
	 * 
	 * @param entity
	 * @throws CMCException
	 */
    @PostLoad 
    public void postLoad(final AccountPreferenceEntity entity) throws CMCException {
    	
    	logger.warn(
    			new StringBuilder().append("\n")
    			.append( "=========================================================================================").append('\n')
    			.append( "| PAY ATTENTION ==> DUE DATANUCLEUS BUG THE METHOD SHOULD NOT BE INVOKED - PLEASE CHECK |").append('\n')
    			.append( "=========================================================================================").append('\n')
    			.toString());
    	//throw new IllegalStateException( "postLoad is invoked!");
    	entity.postLoad();
    }
    
    /*
   		@PostPersist void onPostPersist(final AccountPreferenceEntity entity) throws CMCException {}
	    @PostRemove void onPostRemove(UserEntity user);
	    @PrePersist void onPrePersist(Object o) {}
	    @PreUpdate void onPreUpdate(Object o) {}
	    @PostUpdate void onPostUpdate(Object o) {}
	    @PreRemove void onPreRemove(Object o) {}
     */
}
